Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non repudiation #37

Merged
merged 9 commits into from
Aug 15, 2024
Merged

Non repudiation #37

merged 9 commits into from
Aug 15, 2024

Conversation

jimthematrix
Copy link
Contributor

Add a new circuit that adds encryption with a published authority key of all the secret values of a transaction. This allows the smart contract to enforce non-repudiation with the ZKP, while allowing the authority (which possesses all the secret values of all transactions) to be the arbitrator in disputes.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.44%. Comparing base (7d97f65) to head (dc0f729).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
+ Coverage   65.61%   70.44%   +4.83%     
==========================================
  Files          12       12              
  Lines         538      538              
==========================================
+ Hits          353      379      +26     
+ Misses        145      112      -33     
- Partials       40       47       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Chengxuan Chengxuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally look good to me, some comments on the documentation

solidity/test/zeto_anon_enc_nullifier_non_repudiation.ts Outdated Show resolved Hide resolved
zkp/js/test/anon_enc_nullifier_non_repudiation.js Outdated Show resolved Hide resolved
Copy link
Contributor

@Chengxuan Chengxuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for addressing all the comments @jimthematrix

Comment on lines +131 to +134
// generate shared secret for the authority
var sharedSecretAuthority[2];
component ecdh2 = Ecdh();
ecdh2.privKey <== inputOwnerPrivateKey;
Copy link
Contributor

@EnriqueL8 EnriqueL8 Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not grasping this, we generate a key using the input owner private key to then sign the values passed in so in the future we can check with the public key that the entity that had the private key was the one that tried to perform this transaction?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my understanding is it's used by ECDH to compute the shared key

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we also have an input into the circuit of the authority public key

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a key pair of the public key provided and the private key of the input owner?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the shared secret is used to encrypt rather than sign, the goal is so that the receiver of the encrypted values (the one whose public key is used here) can use their private key and the sender's public key, to derive the same shared secret (this is per the Diffie-Hellman key agreement protocol) to decrypt

Copy link
Contributor

@EnriqueL8 EnriqueL8 Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it now!

  • The inputs are signed by a shared key of the initiator so their private key and the public key of the regulator so only the regulator can in the future decipher them
  • The regulator can then verify that the cipher matches all the other inputs into the circuit by decrypting with a shared key of the regulator private key and the initiator public key!

Awesome

Copy link
Contributor Author

@jimthematrix jimthematrix Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also have an input into the circuit of the authority public key

yes that's the right observation. we are performing two separate encryptions, targeted for two identities (the receiver of the output UTXO, as well as the authority). so we use two separate ECDH to deriver two separate shared secrets to do the encryption

@jimthematrix jimthematrix merged commit bad201a into main Aug 15, 2024
7 checks passed
@jimthematrix jimthematrix deleted the non-repudiation branch August 15, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants